#ifndef __DOWNLOADER_H__
#define __DOWNLOADER_H__

#include <iostream>
#include <string>
#include <thread>
#include <unistd.h>

using namespace std;

namespace Downloader
{
#define DOWNLOADER_VERSION				"V0.0"

	typedef void (*downloader_hook_t)(const char *file, int result, void *arg);
	struct downloader_para {
		string url;				// url
		string save_path;		// download save path
		int thread_cnt;			// download thread count
		void *usr_arg;			// user's parameter pointer
		downloader_hook_t hook;	// callback
	};

	class downloader
	{
	public:
		downloader();
		~downloader();

		string get_version(void);
		int set_info(struct downloader_para *para);
		void main_thread_entry(downloader *dw);

	private:
		string version;
		struct downloader_para *d_para;
	};							// class Downloader
} // namespace

#endif	// #ifndef __DOWNLOADER_H__
